// pages/template/template.js
Page({
  data: {
    commNum:1,
    sortAnimtead: {},
    animtedata: '',
    boxShow:false
  },

  onLoad: function (options) {
  
  },
  // 
  doOrder: function () {
    this.setData({
      boxShow: true,
    });
    var animation = wx.createAnimation({
      duration: 800,
      timingFunction: 'ease',
    });
    this.animation = animation;
    animation.bottom('0').opacity(1).step();
    this.setData({
      animtedata: animation
    })
  },
  // 关闭
  closeBox: function () {
    var that = this;
    var animation = wx.createAnimation({
      duration: 800,
      timingFunction: 'ease',
    });
    this.animation = animation;
    animation.bottom('-500rpx').opacity(0).step();
    that.setData({
      animtedata: animation,
      cartNum: 1
    })
    setTimeout(function () {
      that.setData({
        boxShow: false
      })
    }, 500)
  },
  /**
   *加减 
   */
  operNum: function (e) {
    var that = this;
    var oper = e.currentTarget.dataset.oper
    var num;
    if (oper == '-'){
      that.data.commNum == 1 ? num = 1 : num = that.data.commNum - 1
    }else{
      num = that.data.commNum +1;
    }
    that.setData({
      commNum: num
    })
  }
})